package com.golf.core.course.bodies;

import net.phys2d.raw.Body;
import net.phys2d.raw.StaticBody;
import net.phys2d.raw.shapes.Circle;

/**
 * A (black :) hole.
 * 
 * @author gfloodgate
 */
public class Hole extends AbstractCourseBody 
{
	
	/** The radius of a hole. */
	public static final float HOLE_RADIUS = 10.0f;

    /** The hole position. */
    private final Position position;
    

	/**
	 * Create a hole for the course.
	 * 
	 * @param name The name of this hole.
	 * @param position The hole position.
	 */
	public Hole(final String name, final Position position)
	{
		super(name);
	    this.position = position;
	}

	
	/**
	 * Report the position of the hole.
	 * 
	 * @return The position of this hole.
	 */
	public Position getPosition()
	{
		return position;
	}
	
	// FIXME: The hole radius (drawn) will be much bigger than the physics body that is interacted with.

	
	/**
	 * {@inheritDoc}
	 */
    public Body asPhysicsBody()
    {
        final Body body = new StaticBody(name(), new Circle(HOLE_RADIUS));
        body.setPosition(position.getX() + HOLE_RADIUS, position.getY() + HOLE_RADIUS);
        body.setRestitution(0.4f);
        body.setRotDamping(0.4f);
        body.setFriction(1f);
    
        return body;
    }
	
}
